const express = require('express')

const app = express()

app.get("/index", (req, res, next)=>{
    res.send("首页");
})

app.post("/register", (req, res, next)=>{
    console.log(req.body);
    res.send("注册")
})

app.all("*", (req,res,next)=>{
    console.log("登录验证的路由处理")
    next();
})

app.get("/news", (req, res, next)=>{
    console.log(req.query);
    res.send("新闻");
})

app.all("/abc", (req, res, next)=>{
    console.log(req.method);
    res.send("hello all")
})

app.get("/qwe", (req,res,next)=>{
    console.log(1);
    next();
})
app.get("/qwe", (req,res,next)=>{
    console.log(2)
    res.send("two handle");
})

app.listen(3000, ()=>{
    console.log("服务器启动成功，根地址为： http://127.0.0.1:3000 或 http://localhost:3000")
});